package com.dev.ac.web.server;

import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dev.ac.annotation.Login;
import com.dev.ac.common.Const;
import com.dev.ac.common.Result;
import com.dev.ac.entity.AAuthentication;
import com.dev.ac.service.AActiveService;
import com.dev.ac.service.AAuthenticationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 付
 * @Date 2024-04-15 16:38
 * @Version 1.0
 * @description 活动认证表
 * @since 1.0
 */
@RestController
@RequestMapping("/admin/authentic")
public class AdminAuthenticationController {

	@Autowired
	AAuthenticationService aAuthenticationService;

	@PostMapping("/authentic")
	@Login(issuer = Const.GRADE_ADMIN)
	public Result authentication(@RequestBody List<Integer> activeId) {
		Assert.notNull(activeId, "抱歉，无法识别选择的活动");
		boolean b = aAuthenticationService.authentication(activeId);
		return Result.success(b);
	}

	/**
	 * 获取认证列表
	 *
	 * @return
	 */
	@GetMapping("/list")
	@Login(issuer = Const.GRADE_ADMIN)
	public Result list() {
		// status：0-全部，1-未认证，2-已认证
		Object list = aAuthenticationService.serlectAll();
		return Result.success(list);
	}
}
